package stz.flash.main.flashlight.field;

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.Display;
import net.rim.device.api.ui.XYPoint;
import net.rim.device.api.ui.component.progressindicator.ActivityIndicatorModel;
import net.rim.device.api.ui.component.progressindicator.ActivityIndicatorView;
import blackberry.util.image.DjImageResizer;
import blackberry.util.image.DjImageCalculator;

public class ActivityOrchidField extends ActivityIndicatorView {

	public static final XYPoint XYPOINT_FLASH_LED = new XYPoint(
			DjImageCalculator.imageXIntoDisplay(355, 480),
			DjImageCalculator.imageYIntoDisplay(36, 360));
	public static final XYPoint XYPOINT_FLASH_BACKLIGHT = new XYPoint(
			DjImageCalculator.imageXIntoDisplay(151, 480),
			DjImageCalculator.imageYIntoDisplay(117, 360));
	public static final XYPoint XYPOINT_FLASH_FLASHLIGHT = new XYPoint(
			DjImageCalculator.imageXIntoDisplay(128, 480),
			DjImageCalculator.imageYIntoDisplay(200, 360));
	public static final XYPoint XYPOINT_FLASH_STROBE_WITH_THE_MONKEY = new XYPoint(
			DjImageCalculator.imageXIntoDisplay(190, 480),
			DjImageCalculator.imageYIntoDisplay(268, 360));
	
	public static final XYPoint XYPOINT_STROBE_FLASHLIGHT_MODE = new XYPoint(
			Display.getWidth() + DjImageCalculator.imageYIntoDisplay(26, 480),
			DjImageCalculator.imageYIntoDisplay(274, 360));
	public static final XYPoint XYPOINT_STROBE_MONKEY = new XYPoint(
			Display.getWidth() + DjImageCalculator.imageYIntoDisplay(189, 480),
			DjImageCalculator.imageYIntoDisplay(65, 360));
	
	private static final Bitmap orchidBitmap = DjImageResizer.fitIntoDisplay( 
			Bitmap.getBitmapResource("FlashOrchid.png"),
			64, 32, 480, 360,  0, Bitmap.FILTER_BILINEAR);
	private static final int WIDTH = orchidBitmap.getWidth() / 2;
	private static final int HEIGHT = orchidBitmap.getHeight();
	
	private static XYPoint xyPoint = XYPOINT_FLASH_LED;

	public ActivityOrchidField() {
		super(0);
		setModel(new ActivityIndicatorModel());
		createActivityImageField(
				orchidBitmap,
				2,
				0);
	}

	public static XYPoint getXYPoint() {
		return xyPoint;
	}
	
	public static void setXYPoint(XYPoint xyPoint){
		ActivityOrchidField.xyPoint = xyPoint;
	}
	
	public int getPreferredWidth() {
		return WIDTH;
	}
	
	public int getPreferredHeight() {
		return HEIGHT;
	}
}
